﻿using System;

public partial class partners_product_details : SitePublicBasePage
{
    public String SupplierId
    {
        get
        {
            try
            {
                return Page.RouteData.Values["partnerId"].ToString();
            }
            catch
            {
                return string.Empty;
            }
        }
    }

    public String ProductPath
    {
        get
        {
            try
            {
                return Page.RouteData.Values["path"].ToString();
            }
            catch
            {
                return string.Empty;
            }
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadControlState();
        }
    }

    private void LoadControlState()
    {
        if (!string.IsNullOrEmpty(SupplierId) && ProductPath.EndsWith(".aspx"))
        {
            wucProduct.BindDetails();
            wucProduct.Visible = true;
            ProductListing1.Visible = false;
        }
        else if (!string.IsNullOrEmpty(SupplierId) && !ProductPath.EndsWith(".aspx"))
        {
            wucProduct.Visible = false;
            ProductListing1.Visible = true;
            ProductListing1.LoadListing(ProductPath);
        }
    }
}